<?php
namespace app\admin\controller;

use app\common\model\Persional;
use app\common\model\Fight;

class Enlist extends Base
{
    /**
     * 列表
     * @return \think\response\Json
     */
    public function persional_list()
    {
        if (request()->isPost()) {
            $data = input('');
            $page = input('page', 1);
            $size = input('size', 20);
            $where = [];
            if ($data['name']) {
                $where['name'] = ['like', "%{$data['name']}%"];
            }
            $list = Persional::getPage($where,$page,$size);
            $total = Persional::getCount($where);
            return returnJson(200,'',compact('page','size','list','total'));
        }
    }
    public function team_list()
    {
        if (request()->isPost()) {
            $data = input('');
            $page = input('page', 1);
            $size = input('size', 20);
            $where = [];
            if ($data['name']) {
                $where['name'] = ['like', "%{$data['name']}%"];
            }
            $list = Fight::getPage($where,$page,$size);
            $total = Fight::getCount($where);
            return returnJson(200,'',compact('page','size','list','total'));
        }
    }

    public function del_per()
    {
        if(request()->isPost()){
            $data = input('');
            if($data['id']){
                Persional::destroy($data['id']);
                return returnJson(200,'删除成功');
            }
        }
    }

    public function del_team()
    {
        if(request()->isPost()){
            $data = input('');
            if($data['id']){
                Fight::destroy($data['id']);
                return returnJson(200,'删除成功');
            }
        }
    }

   
}

